#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Filename      :re_demo.py
@Description   :re正则表达式
@Datetime      :2020/09/11 17:28:00
@Author        :AshJo
@Version       :v1.0
"""

import re

# findall 找到所有的匹配返回到列表，且优先返回分组
ret = re.findall('9([0-9])[0-9]', '19740ash93010jo')
print(ret)

# # search 找到所有的匹配返回第一个分组变量，通过指定传实参值选取需要的分组
# ret = re.search('9(\d)(\d)', '19740ash93010jo')
# print(ret)
# if ret:
#     print(ret.group())
#     print(ret.group(1))
#     print(ret.group(2))

# # 静态页面爬去豆瓣电影的标题
# with open('Python_fullstack\day19\douban.html', encoding='utf-8') as f:
#     content = f.read()

# # <span class="title">霸王别姬</span>
# res = re.findall('<span class="title">(\w+)</span>', content)
# print(res)
